Skip to main content

mobileSensorReading

Type

function

Summary

Returns the reading from the named sensor.

Syntax

mobileSensorReading(<sensor>, <detailed>)

Description

Use the mobileSensorReading function to fetch a reading from the named device sensor.

The mobileSensorReading function returns a reading from the named sensor.

note

When speed is returned, the value is in meters per second. To convert to miles per hour, multiply the value by 2.237. To convert to kilometers per hour, multiply it by 3.6 instead.

Parameters

NameTypeDescription

sensor

enum

The name of the sensor you wish to start using

detailed

enum

How detailed the readings from sensors should be. The default value is false

Examples

get mobileSensorReading("heading",false)
put mobileSensorReading("location",true) into tDeviceLocation

Value

NameTypeDescription

return

  • Location - a comma separated list of the latitude, longitude and altitude of the device. If any of these readings are not available, an empty item will be returned in its place. If detailed is true an array containing the keys latitude, longitude, altitude, timestamp, horizontal accuracy and vertical accuracy is returned. Additionally, if values for them exist, the keys speed and course are included in the returned array.
  • Heading - the heading of the device in degrees. If detailed is true an array containing the keys heading, magnetic heading, true heading, timestamp, x, y, z and accuracy is returned.
  • Acceleration - a comma separated list of the acceleration in the x, y and z axes. If detailed is true an array containing the keys x, y, z and timestamp is returned.
  • Rotation Rate - a comma separated list of the rate of rotation around the x, y and z axes. If detailed is true an array containing the keys x, y, z and timestamp is returned.

function: mobileCanTrackHeading, mobileCanTrackLocation, mobileCurrentHeading, mobileCurrentLocation

message: headingChanged, accelerationChanged, locationChanged, rotationRateChanged, trackingError

command: mobileStopTrackingSensor, mobileStartTrackingSensor

Compatibility and Support

Introduced

LiveCode 5.5

OS

ios

android

Platforms

mobile

Thank you for your feedback!

Was this page helpful?